{extend name="$index_style_layout" /}
{block name="head_title"}{$info.title} -> {:M('name')}{/block}

{block name="body_content"}
<link rel="stylesheet" href="__STATIC__/group/member.css">
<div class="MainMemberBox ShowContentType">
<!--
	<div class='TopBox'>
	  <div class='home'><a href="{:urls('content/show',['id'=>$id])}"><i class="fa fa-reply"></i>首页</a></div>
	  <div class='name'>圈友排行榜</div>
	  <div class='member'><a href="#"><i class="fa fa-user-o"></i></a></div>
	</div>
-->
	<div class='ShowTypes'>
	  <div>活跃圈友</div>
	  <div>最新加入</div>
	</div>
<style type="text/css">
.listmemberBox .lists{
	position:relative;
}
.listmemberBox .lists .del-member{
	position:absolute;
	right:0px;
	font-size:18px;
}
.listmemberBox .lists .yz-member{
	position:absolute;
	right:30px;
	font-size:18px;
}
</style>
	<div class='listmemberBox'>
{qb:tag name="qun_member_wapindex" class="app\qun\model\Member@get_label" rows="10" union="aid=id,order,by,power" order="view" by="desc"}
	    <div class='lists list{$i}'>		
		{if $cfg.power==2||$cfg.power==3}
			{if $rs.type==0}<i data-id="{$rs.id}" class="yz-member fa fa-check-circle" title="审核"></i>{/if}
			<i data-id="{$rs.id}" class="del-member fa fa-times-circle" title="踢除"></i>
		{/if}
	      <div class='icon'><a href="{:get_url('user',$rs['uid'])}"><img src="{$rs.icon}" onerror="this.src='__STATIC__/images/nobody.gif'"></a></div>
	      <div class='infos'>
	        <div class='name'><div class='num'>NO.{$i}</div><text>{$rs.username}</text></div>
	        <div class='more'>
	          <div class='iconfont'><i class="fa fa-arrows-v"></i>身份：<text>{if $rs.type=="2"||$rs.type=="3"}管理员{elseif $rs.type==0}待审会员{else /}普通会员{/if}</text></div>
	          <div class='time'>{$rs.create_time} 加入</div>
	        </div>
	      </div>
	    </div>
{/qb:tag}
	</div>
	<div class='listmemberBox'></div>
	<div class="ShowMores"><span>查看更多</span></div>
</div>

<script type="text/javascript">
var admin = {if $power==2||$power==3}true{else /}false{/if};
//踢除会员
function delete_member(){
	$(".del-member").each(function(){
		var that = $(this);
		if(admin!=true){
			that.hide();
			return ;
		}
		that.click(function(){
			var url = "{:urls('wxapp.member/act')}?type=del&id="+that.data('id');
			$.get(url,function(res){
				if(res.code==0){
					that.parent().hide();
					layer.msg('操作成功');
				}else{
					layer.alert('操作失败:'+res.msg);
				}
			});
		})
	});
}

//验证会员
function yz_member(){
	if(admin!=true){
		return ;
	}
	$(".yz-member").each(function(){
		var that = $(this);
		that.click(function(){			
			var url = "{:urls('wxapp.member/act')}?type=yz&id=" + that.data('id');
			$.get(url,function(res){
				if(res.code==0){
					that.css('color','green');
					layer.msg('操作成功');
				}else{
					layer.alert('操作失败:'+res.msg);
				}
			});
		})
	});
}
delete_member();
yz_member();
</script>


<script type="text/javascript">

var ajax_url_db = ['&order=view&','&order=id&'];
var choose_i = 0; //选中第几项
var haveshowpage = []; //每一项,作个标志,已经已显示到第几页
    haveshowpage[0] = 1; //第一项就从第二页开始

//显示更多
function showMoreContent(){	
	var url = ajax_url_db[choose_i];	//第几项对应的网址
	haveshowpage[choose_i]++;
	$.get('{qb:url name="qun_member_wapindex"/}' + haveshowpage[choose_i] + url + Math.random(),function(res){
		if(res.code==0){
			if(res.data==''){
				layer.msg("已经显示完了！",{time:500});
				$('.ShowMores').off("click");
				$('.ShowMores span').html('显示完了');
			}else{
				if(haveshowpage[choose_i]==1){
					$('.ShowContentType .listmemberBox').eq(choose_i).html(res.data);
				}else{
					$('.ShowContentType .listmemberBox').eq(choose_i).append(res.data);
				}
				scroll_get = true;
				delete_member();
				yz_member();
			}
		}else{
			layer.msg(res.msg,{time:2500});
		}
	});
}


//切换显示
function showContentType(num){

	choose_i = num;
	$('.ShowMores').off("click");	//先移除,避免重复加多次click事件
	$('.ShowMores').on("click",showMoreContent);
	$('.ShowMores span').html('查看更多');
	//$('.ShowMores').css({'background':'orange'});

	if(haveshowpage[num]==undefined){
		haveshowpage[num] = 0;
		showMoreContent();
	}

	$('.ShowContentType .ShowTypes div').removeClass('ck');
	$('.ShowContentType .ShowTypes div').eq(num).addClass('ck');
	$('.ShowContentType .listmemberBox').hide();
	$('.ShowContentType .listmemberBox').eq(num).show();
}
$('.ShowContentType .ShowTypes div').click(function(){
	showContentType( $(this).index() );
});
showContentType(0);


//滚动显示更多
var scroll_get = true;	//做个标志,不要反反复复的加载
$(document).ready(function () {
	$(window).scroll(function () {
		if (scroll_get==true &&  (400 + $(window).scrollTop())>($(document).height() - $(window).height())) {
			scroll_get = false;			
			layer.msg('内容加截中,请稍候',{time:1500});
			showMoreContent();
		}
	});
});

</script>
{/block}